package com.treasure.mall.biz.dto.wechat;

import com.treasure.mall.biz.dto.BaseSaveDTO;
import com.treasure.mall.zbq.common.ienum.base.CodeDescEnumHelper;
import com.treasure.mall.zbq.common.ienum.wx.WxMsgType;
import lombok.Data;

/**
 *
 * <p>
 * +---------------------------------------------------------
 * * @package: com.treasure.mall.biz.dto.wechat
 * * @author: guomw (guomwchen@foxmail.com)
 * * @date: 2020/9/15 11:20 上午
 * * @since: V1.0.0
 * +---------------------------------------------------------
 * 注意：本内容仅限于内部传阅，禁止外泄以及用于其他的商业目的
 *
 */
@Data
public class KeywordMessageDTO implements BaseSaveDTO {

    /**
     * 关键词
     */
    private String keyword;

    /**
     * 消息内容
     */
    private String content;

    /**
     * 图片地址
     */
    private String url;
    /**
     * 消息类型{@link com.treasure.mall.zbq.common.ienum.wx.WxMsgType}
     */
    private WxMsgType msgType = WxMsgType.TEXT;

    /**
     * 消息类型{@link com.treasure.mall.zbq.common.ienum.wx.WxMsgType}
     */
    private int type = 0;


    public WxMsgType getMsgType() {
        WxMsgType wxMsgType = CodeDescEnumHelper.getEnumTypeByCode(WxMsgType.class, type);
        if (wxMsgType != null) {
            return wxMsgType;
        }
        return WxMsgType.TEXT;
    }

}
